package com.yuneec.droneservice.command;

import com.yuneec.droneservice.model.JoystickMap;
import com.yuneec.droneservice.request.IResponse;

/**
 * Created by gjw on 2017/3/27.
 */

public class SetJoystickMap extends BaseCommand {

    public SetJoystickMap(JoystickMap map) {
        super(MAV_RC_COMMAND.MAV_RC_CMD_SET_CH_MAP);
        data = new byte[4];
        data[0] = (byte) map.getCh1();
        data[1] = (byte) map.getCh2();
        data[2] = (byte) map.getCh3();
        data[3] = (byte) map.getCh4();
    }


    @Override
    public IResponse toResponse(byte[] data, int off, int len) {
        int code = data[off + 1] & 0xff;
        return new IResponse(ids(), code);
    }
}
